package subumbo.micro.component
{
	import flash.events.MouseEvent;
	
	import subumbo.micro.controller.ApplicationEvent;
	import subumbo.micro.controller.Component;
	
	public class ClickDispatcher
	{
		protected var _uiComponent:Component;
		
		public function ClickDispatcher(uiComponent:Component)
		{
			init(uiComponent);
		}
		
		private function init(comp:Component):void
		{
			_uiComponent = comp;
			_uiComponent.buttonMode = true;
			_uiComponent.mouseChildren = false;
			_uiComponent.addEventListener(MouseEvent.MOUSE_DOWN, onDown);
		}
		
		protected function onDown(e:MouseEvent):void
		{
			_uiComponent.dispatchEvent(new ApplicationEvent(ApplicationEvent.CONTROL, _uiComponent.vo));
		}
		
		public function dispose():void
		{
			_uiComponent = null;
		}
		

	}
}